package mybatis34.test;

import javafx.scene.control.TextArea;
import mybatis34.dao.UserDaoImpl;
import mybatis34.entity.User;
import mybatis34.mapper.UserMapper;

import javax.jws.soap.SOAPBinding;
import java.util.Date;
import java.util.List;

public class test {
    public void test1(){
        List<User> users = sqlSession.selectList("findUserByName","张");
        for (User user:users){
            System.out.println(user);
        }
    }
    @org.junit.Test
    public void test2(){
       /* User user = new user();
        user.setUsername("张三丰");
        user.setBirthday(new Date());
        user.setAddress("枣庄");
        user.setSex("1");
        TextArea.TextAreaContent sqlSession;
        sqlSession.insert("insertUser",user);
        User user1 =new User();
        user.setId(29);
        user.setUsername("张无忌");
        user.setSex("9");
        Object sqlsession;
        sqlsession.update("updateuser",user);
        sqlSession.commit();
         sqlSession.delete("deleteUser",29);
         sqlSession.commit();*/
    }
    @After
    public void after(){sqlSession.close();}
    @org.junit.Test
    public void testDao(){
        UserDaoImpl userDao = new UserDaoImpl(sqlSession);
        User user = userDao.findUserById(1);
        System.out.println(user);
    }
   @org.junit.Test
    public void test4(){
       UserMapper mapper = sqlSession.getMapper(UserMapper.class);
       User user=mapper.findUserById(1);
       System.out.println(user);
    }
}
